package com.study.stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Stream {

    public static void main(String[] args) {
        List<User> users= Arrays.asList(
                new User(1,"a",3,1),
                new User(2,"aa",12,1),
                new User(3,"aaa",1,0),
                new User(4,"aaaa",14,1)
        );

        List<Integer> ids= users.stream()
                .filter(user ->  user.getAge()>2)
                .filter(user ->  user.getId()>1)
                //.sorted(Comparator.comparing(User::getAge).reversed())
                .map(User::getId).forEach();
                //.collect(Collectors.toList());
        System.out.println( ids.toString());

         IntStream.rangeClosed(2, 10).filter(i -> i > 2).distinct();

    }

}
